package buildcode.language.java.type;

import java.util.List;
import java.util.stream.Collectors;

import buildcode.database.DataBaseTable;
import buildcode.language.Type;
import buildcode.language.java.field.JavaField;
import buildcode.util.CommonUtil;

public class JavaEntity extends JavaType<JavaField, DataBaseTable> {

    public JavaEntity(String name, String packagePath) {
        super(name, packagePath);
    }

    @Override
    public List<Type> getImportTypes() {
        return getFields().stream().filter(v -> CommonUtil.isNeedImport(v, this.getPackagePath())).map(v -> v.getType()).distinct().collect(Collectors.toList());
    }

}
